<h1>Types of objects</h1>

<% if @object_types.size > 0 %> 
	<% object_type_data = Array.new %>
	<% object_type_labels = Array.new %>

	<% for object_type in @object_types %>
		<% object_type_data << object_type.count %>
		<% object_type_labels << object_type.name %>
	<% end %>


	<div class="chart">
		<%= google_chart("440x220", {:type => "bar", 
			:data => object_type_data, 
			:labels => object_type_labels
			}) 
			%>	
	
	</div>
	<div class="selected_data">
	
		<% top_object_types = Array.new %>	
		<% @top_object_types.each do |o| %>
			<% top_object_types << [o.name, o.id, o.count] %>
		<% end%>
		<% top_object_types.sort! %>
	
		<h2>Top categories</h2>
		<ul class="object_types">
			<% for object_type in top_object_types %>
				<li><%= link_to(pluralize(object_type[2], object_type[0]), museum_object_type_path(@museum, object_type[1]))%>
				</li>
			<% end %>
		</ul>
	</div>
<% else %>	
	<p class="no_data">(sorry, we don't have any data about object types for this museum)</p>
<% end %>

<div style="clear:both;">&nbsp;</div>